home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / common.h,v < prev    next >
Text File  |  1995-06-12  |  7KB  |  260 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.2;
  5. locks    death:1.3;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     93.04.04.23.45.35;  author death;  state Exp;
  11. branches ;
  12. next     1.2;
  13.  
  14. 1.2
  15. date     93.01.10.15.09.00;  author death;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     92.07.26.13.57.07;  author death;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @update...
  27. @
  28.  
  29.  
  30. 1.3
  31. log
  32. @Sun Apr  4 23:45:34 PDT 1993
  33. @
  34. text
  35. @/*
  36. ====================================================================
  37. This file declares several data types that varoious applications may wish to use.
  38.     This is $Revision: 1.2 $ of this file
  39.     It was last modified by $Author: death $ on $Date: 93/01/10 15:09:00 $
  40. Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
  41. $Log:    common.h,v $
  42.  * Revision 1.2  93/01/10  15:09:00  death
  43.  * Sun Jan 10 15:09:00 PST 1993
  44.  * 
  45.  * Revision 1.1  92/07/26  13:57:07  death
  46.  * Initial revision
  47.  * 
  48.  * Revision 1.1  92/02/09  18:41:40  death
  49.  * Initial revision
  50.  * 
  51. ====================================================================
  52. */
  53.  
  54. //
  55. //    92.11.08        djb        Added NSmajor and NSMinor flags, since there don't seem to
  56. //                        be any in the NS headers (probably I'm not looking in the
  57. //                        right place).  This isn't the right place for them, but...
  58. //
  59. #define    NSmajor        3
  60. #define    NSminor        0
  61.  
  62. #define    DoNS3DragNDrop 1
  63.  
  64. #import <objc/objc.h>
  65.  
  66. //
  67. //    Draft 1 of standard types.  I can see this is a small step towards making everything an
  68. //    object. But, we'll see how we like what we have.  I'm a bit bothered by Cstring, for now,
  69. //    but...
  70. //
  71. //     Integer should be the largest available signed intergral number on the system.
  72. //    It is capitalized and fully spelled to help distnguish from normal int's in C.
  73. //    Naturally, PositiveInteger is it's unsigned counterpart.  Note that PositiveInteger,
  74. //    despite it's name, does include 0! =)
  75. //
  76. typedef     long int    Integer;
  77. typedef    unsigned long int    PositiveInteger;
  78. //
  79. //    92.06.21 djb    added 'Real' type.
  80. //
  81. typedef    double    Real;
  82. //
  83. //    Character is used to represent a letter, digit, or symbol on the local system.  It makes no
  84. //    pretenses at being able to deal with an ideographic, or potentially even a sylabic writing
  85. //    system.  In general, it should not be used as a number  (C's char type is a signed thing, so
  86. //    CString, below, does NOT refer to an array of Character. =(  )
  87. //
  88. typedef    unsigned char    Character;
  89. //
  90. //    Cstring is a special case, since one just ends up using pointers to chars frequently.
  91. //    roCString is a read only cstring.  I could have made rocstring as char const *, but
  92. //    it seemed more appropriate to make the name refer to read-only (constant) data,
  93. //    rather than pointer.
  94. //    How about fixedCString for those that are char const *??
  95. //
  96. typedef    char*    CString;
  97. typedef    const char*    roCString;
  98. //
  99. //    id is all well and good, but let's be a bit more general and readable.  So, we define
  100. //    Instance to be a reference to an object
  101. //    NOTE: Seems I can't call it Object bcause there is already a class called Object (oops).
  102. //    Naming it thus Instance.  Since id/object/instance is the default type in Objective C,
  103. //    one really won't need to use the name all that often.
  104. //
  105. typedef     id    Instance;
  106. //
  107. //    Pointer is a reference to an untyped pointer.
  108. //
  109. typedef    void*    Pointer;
  110. //
  111. //    Boolean is, of course, a type for storing true or false values.  no others (undefined, etc)
  112. //
  113. typedef    BOOL    Boolean;
  114. //
  115. //    GenericType is used to store any of the preceeding types.
  116. //
  117. typedef union
  118. {
  119.     Integer        integer;
  120.     PositiveInteger    positiveinteger;
  121.     Character    character;
  122.     CString        cstring;
  123.     Instance        instance;
  124.     Pointer        pointer;
  125.     Boolean        boolean;
  126. }
  127. GenericType;
  128. //
  129. //    DataType is used to store any of the primary data types here, like GenericType, but
  130. //    also to record which type is stored, and thus allow for some type checking by the
  131. //    programmer.
  132. //
  133. typedef struct
  134. {
  135.     GenericType    data;
  136.     Integer        type;
  137. }
  138. DataType;
  139. //
  140. //    Now, define some values that correspond to thse types...
  141. //
  142. //    (Ahh, for C++'s ability to define constants...)
  143. //
  144. #define    CARRIAGERETURN        0x0D
  145. #define    LINEFEED                0x0A
  146. #define    NEWLINE                0x0A
  147. #define    TAB                        0x09
  148. //#define    NULL                    0x00    /* already defined, I believe */
  149. #define    ESCAPE                    0x1B
  150. #define    NullCharacter            0x00
  151. //
  152. //    Cstring definitions
  153. //
  154. #define    NullCString    ((CString) 0x00)
  155. #define    EndOfCString    ((char) 0x00)
  156. //
  157. //    Object definitions
  158. //    (nil is defined as part of Objective c.  note the case! Nil is a nil Class structure).
  159. //
  160. #define    NullInstance    ((Instance) nil)
  161. //
  162. //    Pointer definitions
  163. //
  164. #define    NullPointer    0x00
  165. //
  166. //    Boolean definitions.
  167. //
  168. //#define    YES        /* Defined by Objective C.  uncomment if this changes or this moves*/
  169. //#define    NO        /* Defined by Objective C.  uncomment if this changes or this moves*/
  170. #define    True    YES
  171. #define    False    NO
  172. //
  173. //    Define constants for use in the DataType struct
  174. //
  175. #define    TYPE_NONE                0
  176. #define    TYPE_INTEGER            1
  177. #define    TYPE_POSITIVEINTEGER    2
  178. #define    TYPE_CHARACTER        3
  179. #define    TYPE_CSTRING            4
  180. #define    TYPE_INSTANCE        5
  181. #define    TYPE_POINTER            6
  182. #define    TYPE_BOOLEAN            7
  183.  
  184. //
  185. //    Define some types. 
  186. //    These can all be considered as special cases of PositiveInteger, below.
  187. //    92.08.02    Added signed versions, for those cases where one needs specific sized
  188. //            signed integers.
  189. //
  190. typedef    unsigned char        Byte;
  191. typedef    char                SignedByte;
  192. typedef    unsigned char        bits8;
  193. typedef    char                Signed8Bits;
  194. typedef    unsigned short int    bits16;
  195. typedef    short int                Signed16Bits;
  196. typedef    unsigned int            bits32;
  197. typedef     int                    Signed32Bits;
  198. typedef    Byte*                ByteString;
  199. typedef    const Byte*            ConstByteString;
  200. typedef    Integer                ErrorCode;
  201.  
  202. #define    NullByteString    ((ByteString) 0x00)
  203.  
  204. //    92.05.25    djb    Added a ConstCString.  The name is misleading in that it suggests the
  205. //    data, not the pointer, is constant.  But, its what comes to mind first, andI'm using this
  206. //    far and away more frequently than any other const construct...
  207. //
  208. typedef    char const *    ConstCString;
  209.  
  210. //
  211. //    Prototypes
  212. //
  213. Boolean    EvenUnsignedNum (PositiveInteger);
  214. CString    NewCString(PositiveInteger);
  215. void    FreeCString(CString theString);
  216. ByteString    NewByteString(PositiveInteger);
  217. void    FreeByteString(ByteString theString);
  218. Pointer    NewPointer(PositiveInteger length);
  219. void    FreePointer(Pointer thePointer);
  220. @
  221.  
  222.  
  223. 1.2
  224. log
  225. @Sun Jan 10 15:09:00 PST 1993
  226. @
  227. text
  228. @d4 2
  229. a5 2
  230.     This is $Revision: 1.1 $ of this file
  231.     It was last modified by $Author: death $ on $Date: 92/07/26 13:57:07 $
  232. d8 3
  233. d25 4
  234. a28 2
  235. #define    NSmajor        2
  236. #define    NSminor        1
  237. @
  238.  
  239.  
  240. 1.1
  241. log
  242. @Initial revision
  243. @
  244. text
  245. @d5 1
  246. a5 1
  247.     It was last modified by $Author: death $ on $Date: 92/02/09 18:41:40 $
  248. d7 4
  249. a10 1
  250. $Log:    generalTypes.h,v $
  251. d17 8
  252. d148 2
  253. d152 1
  254. d154 1
  255. d156 1
  256. d158 1
  257. d160 1
  258. d162 2
  259. @
  260.